const qiniu=require("qiniu");
const nanoid=require("nanoid");
const config=require("../config");
const bucket=config.qiniu.bucket;
const mac=new qiniu.auth.digest.Mac(config.qiniu.AK,config.qiniu.SK)
const cfg=new qiniu.conf.Config();
const client=new qiniu.rs.BucketManageer(mac,cfg);
const uploadToQinniu=async (url,key)=>{
    return new Promise((res,rej)=>{
        client.fetch(url,bucket,key,(err,ret,info)=>{
            if(err){
                rej(err)
            }else{
                if(info.statusCode===200){
                    res({key})
                }else{
                    rej(info)
                }
            }
        })
    })
}

;(async ()=>{
    
})()